package com.example.seckilldemo.config.mq;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author Wangbaba
 * @Date 2024/3/21 15:13
 * @Version 1.0
 */
@Configuration
public class RabbitMQConfig {
    private static final String QUEUE="seckillQueue";
    private static final String EXCHANG="seckillExchange";

    @Bean
    public Queue seckillQueue(){
        return new Queue(QUEUE);
    }
    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange(EXCHANG);
    }
    @Bean
    public Binding bindingTopic01(){
        return BindingBuilder.bind(seckillQueue()).to(topicExchange()).with("seckill.#");
    }
}
